package com.ruoyi.project.jiaqin.numbertips.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.jiaqin.numbertips.domain.NumberTips;
import com.ruoyi.project.jiaqin.numbertips.mapper.NumberTipsMapper;
import com.ruoyi.project.jiaqin.numbertips.service.INumberTipsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 数字提示Service业务层处理
 *
 * @author LCL
 * @date 2022-01-12
 */
@Service
public class NumberTipsServiceImpl implements INumberTipsService
{
    @Autowired
    private NumberTipsMapper numberTipsMapper;

    /**
     * 查询数字提示
     *
     * @param id 数字提示ID
     * @return 数字提示
     */
    @Override
    public NumberTips selectNumberTipsById(String id)
    {
        return numberTipsMapper.selectNumberTipsById(id);
    }

    /**
     * 查询数字提示列表
     *
     * @param numberTips 数字提示
     * @return 数字提示
     */
    @Override
    public List<NumberTips> selectNumberTipsList(NumberTips numberTips)
    {
        return numberTipsMapper.selectNumberTipsList(numberTips);
    }

    /**
     * 新增数字提示
     *
     * @param numberTips 数字提示
     * @return 结果
     */
    @Override
    public int insertNumberTips(NumberTips numberTips)
    {
        numberTips.setId(UUID.randomUUID().toString().replace("-",""));
        numberTips.setFansNum(0);
        numberTips.setVisitorNum(0);
        numberTips.setQuotationNum(0);
        numberTips.setSupplyNum(0);
        numberTips.setWantToBuyNum(0);
        numberTips.setNewsNum(0);
        numberTips.setQuestionsNum(0);
        numberTips.setCooperateNum(0);
        numberTips.setFollowQuotationNum(0);
        numberTips.setFollowSupplyNum(0);
        numberTips.setFollowWantToBuyNum(0);
        return numberTipsMapper.insertNumberTips(numberTips);
    }

    /**
     * 修改数字提示
     *
     * @param numberTips 数字提示
     * @return 结果
     */
    @Override
    public int updateNumberTips(NumberTips numberTips)
    {
        return numberTipsMapper.updateNumberTips(numberTips);
    }

    /**
     * 删除数字提示对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteNumberTipsByIds(String ids)
    {
        return numberTipsMapper.deleteNumberTipsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除数字提示信息
     *
     * @param id 数字提示ID
     * @return 结果
     */
    @Override
    public int deleteNumberTipsById(String id)
    {
        return numberTipsMapper.deleteNumberTipsById(id);
    }

    @Override
    public NumberTips selectNumberTipsByMemberId(String memberId) {
        return numberTipsMapper.selectNumberTipsByMemberId(memberId);
    }
}
